package com.liduanwei.update;

import com.liduanwei.update.app.AppService;
import com.liduanwei.update.util.PrintUtil;

public class App {

    static public final String ARG_CHECK_NEW_VERSION_FORCE = "-checkNewVersion-force";

    public static void main(String[] args) {
        PrintUtil.Companion.print("## args: usage: " + ARG_CHECK_NEW_VERSION_FORCE + ": 强制立即检查新版本(可用于 mqtt通知立即执行)");

        handleArgs(args);
    }

    private static void handleArgs(String[] args) {
        boolean isForce = false;
        for (String arg : args) {
            if (arg.equals(ARG_CHECK_NEW_VERSION_FORCE)) {
                PrintUtil.Companion.print(ARG_CHECK_NEW_VERSION_FORCE);
                AppService.startCheckNewVersionForce();
                isForce = true;
            }
        }
        if (!isForce) {
            /*未强制执行版本检查则开启quartz定时任务*/
            AppService.startSchedule();
        }
    }

}
